<template>

    <div class="upload">
        <el-select v-model="report" placeholder="选择你要上传的报告类型" style="display: inline-block;">
                    <el-option label="开题报告" value="开题报告"></el-option>
                    <el-option label="最终报告" value="最终报告"></el-option>
        </el-select>
        <el-upload
            class="upload-demo"
            ref="upload"
            :action="action"
            :on-preview="handlePreview"
            :on-remove="handleRemove"
            :file-list="fileList"
            :auto-upload="false">
            <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
            <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
            
        </el-upload>
  </div>
</template>

<script>
export default {
    data() {
      return {
        report:'',
        action: '' ,
        fileList: [
            
            ]
      };
    },
    methods: {
      submitUpload() {
        this.action = `https://jsonplaceholder.typicode.com/posts/`
        this.$refs.upload.submit();
      },
      handleRemove(file, fileList) {
        console.log(file, fileList);
      },
      handlePreview(file) {
        console.log(file);
      }
    }
}
</script>

<style>
.upload{
    width: 25%;
    
}
</style>